package com.ideal.proxy.entity;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

/**
 * ApiBase 请求类
 *
 * @author ideal-20
 * @date 2023-08-05 00:11
 **/
@AllArgsConstructor
@NoArgsConstructor
@Data
@Builder
public class ApiBaseRequest {
    /**
     * 语雀 api 地址
     */
    private String apiUrl;

    /**
     * 语雀 Token
     */
    private String token;

    /**
     * 来源可以不填 默认 test
     */
    private String source;

    public String getApiUrl() {
        if (StringUtils.isNotBlank(this.apiUrl)) {
            return this.apiUrl;
        }
        return "https://www.yuque.com/api/v2";
    }

    public String getSource() {
        if (StringUtils.isNotBlank(this.source)) {
            return this.source;
        }
        return "test";
    }
}